﻿using J.ProductGet.Application.Command.UploadPicturesCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace J.ProductGet.Controllers
{
    /// <summary>
    /// 图片上传
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UploadPicturesController : ControllerBase
    {
        public readonly IMediator _Mediator;
        public UploadPicturesController(IMediator mediator)
        {
            _Mediator = mediator;
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> GetPicture(UploadPicturesShowCommand command)
        {
            return Ok(await _Mediator.Send(command));
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> BackPicture(UploadPicturesBackCommand command)
        {
            return Ok(await _Mediator.Send(command));
        }
    }
}
